<html>
  <head>
    <title></title>
    <style>
    
    frame {  background: #A2C2EA #A2C2EA #638EC8 #638EC8; }
    
    frame > pagebox {
      background-color:white;
      /*border: 1px solid #444;*/
      box-shadow: 2dip 2dip 6dip #224;
    }
    
    </style>
    <script type="text/tiscript">
      var pager = $(frame);
      var currentPageNo = $(#current-page);
      var contentUrl = self.url("samples/print-test.htm");

      event click $(button#select-printer) {  pager.selectPrinter(); }
      
      event click $(button#print) { 
        pager.print(); // print all pages
        //pager.print([1]); // print only first page
      }
      
      event change $(select#to-load) { 
        contentUrl = self.url( this.value );
        currentPageNo.attributes["max"] = 1;
        currentPageNo.value = 1;
        pager.loadDocument( contentUrl ); 
      }
      
      event change $(#current-page) {
        pager.pageNo( this.value );
      }

      event click $(button#load-template-alt) { 
        var templ = self.url("page-template-alt.htm");
        pager.loadDocument( templ, contentUrl ); 
      }
      
      event paginationend $(frame) (evt) {
        $(#numpages).value = evt.reason;
        $(#current-page).attributes["max"] = evt.reason;
      }
      
      event click $(button#load-from-mem){ 
        pager.loadHtml( "<html><body>this is a test.</body></html", "about:blank"); 
      }
      
    </script>
  </head>
<body>
  <p>Sciter print preview using <code>&lt;frame|pager&gt;</code></p>
  <button #select-printer>Select printer</button>
  <button #print>Print</button>
  <button #load-template-alt>set alt template</button>

  <button #load-from-mem>Load HTML from memory</button>
  
  Load <select|dropdown #to-load>
    <option>samples/print-test.htm</option>
    <option>cheat-sheets/script.htm</option>    
    <option>cheat-sheets/script-dom.htm</option>
    <option>samples/print-svg.htm</option>
    <option>samples/print-drawing.htm</option>
    <option>samples/print-image.htm</option>
    <option>samples/print-metrics.htm</option>
    <option>http://www.terrainformatica.com/tests/printing/print-image.htm</option>
  </select>
  
  Page <input|integer #current-page value=1 step=1 min=1 max=1> of 
  pages: <output|integer #numpages />
  <frame|pager cols=2 src="samples/print-test.htm" page-template="page-template.htm" />
</body>
</html>
